<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"
    import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改設備分類</title>
<script language="JavaScript">
  function formCheck()
  {
     if(document.form1.fcname.value == ""){
	      alert("請填寫設備類別名稱");
		  document.form1.fcname.focus()
		  return false;
	 }
  }
</script>
</head>
<body>
<% if(session.getAttribute("access") == "y" ){%>
<jsp:useBean id="mydb" scope="page" class="bean.ConDbBean"/> <%//連結資料庫的bean %>
<% 
	  String fcid=request.getParameter("fcid");
	  String sql="select * from FACILITY_CLASS WHERE FC_ID='"+fcid+"'";
	  ResultSet rs=mydb.executeQuery(sql); 
	  rs.next();
	  %>
	  
<table width="750" border="0" align="center">
  <tr>
    <td width="30" rowspan="4"><jsp:include page="../frameset/left.jsp" flush="true" ></jsp:include></td>
    <td colspan="2"><jsp:include page="../frameset/top.jsp" flush="true" ></jsp:include></td>
    <td width="40" rowspan="4"><jsp:include page="../frameset/right.jsp" flush="true" ></jsp:include></td>
  </tr>
  <tr>
    <td rowspan="2"><jsp:include page="../frameset/mean.jsp" flush="true" ></jsp:include>

    </td>
    <td height="32"><jsp:include page="../frameset/pfm_mean.jsp" flush="true" ></jsp:include></td>
  </tr>
  <tr>
    <td>
    <table width="400" border="0" align="center">
  <tr>
    <td><form id="form1" name="form1" method="post" action="do_alterFClass.jsp">
      <table width="100%" border="1" align="center">
        <tr>
          <td width="38%">分類編號</td>
          <td width="62%"><input type="hidden" name="fcid" value="<%=fcid%>"/><%=fcid%></td>
        </tr>
        <tr>
          <td>分類名稱</td>
          <td><input type="text" name="fcname" value="<%=rs.getString("FC_NAME")%>"/></td>
        </tr>
        <tr>
          <td colspan="2"><div align="center">
            <input type="reset" name="Submit" value="重新填寫" />
            <input type="submit" name="Submit2" value="確定" onClick="return formCheck()"/>
          </div></td>
          </tr>
      </table>
    </form>
    </td>
  </tr>
</table>
    </td>
  </tr>
  <tr>
    <td colspan="2"></td>
  </tr>
</table>
<%
  }
  else{
  	response.sendRedirect("../index.jsp"); //若沒有登入則回到index.jsp
  } 
  %>

</body>
</html>